import Request from '@/utils/request'
import Cookies from '@/utils/auth'

const state = () => ({
	
})
const getters = {
	
}
const mutations = {
	
}
const actions = {
	async get_cur_activity_list({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/activity/getCurrentActivity',params,{unLoading:true})
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_card_list({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/card/listPageCard',params,{unLoading:true})
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_card_detail({commit}, cardId) {  
		return new Promise((resolve,reject)=>{
			Request.get(`/api/card/getCardDetail/${cardId}`)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async collect_card({commit}, params) {  // 收集卡片
		return new Promise((resolve,reject)=>{
			Request.post('/api/card/collect',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_my_card_list({commit}, params) {  // 我的卡片
		return new Promise((resolve,reject)=>{
			Request.post('/api/card/listUserCardDetail',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_card_chain_info({commit}, cardId){  
		return new Promise((resolve,reject)=>{
			Request.get(`/api/card/getCardChainDetail/${cardId}`)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
}

export default {
	namespaced: true,
	state,
	getters,
	mutations,
	actions
}
